#include "context_helper.h"

namespace Common
{

ContextValue contextFromJson(const Common::Json& json)
{
    return ContextValue(crow::json::load(json.dump()));
}

ContextValue contextFromElement(const Elements::ElementPtr element)
{
    if (element)
        return contextFromJson(element->toJson());
    return {};
}

std::vector<ContextValue> ContextList::data() const
{
    return m_data;
}

ContextList& ContextList::operator<<(const ContextValue& value)
{
    m_data.push_back(value);
    return *this;
}

} // namespace Common
